@extends('admin.layouts.master')

@section('content')

<div class="row aw-list">
	<div class="col-lg-12">
		<section class="panel aw-content">
			<header class="panel-heading">查询条件</header>
			<div class="aw-mt20 overflow-hidden">
				<div class="col-sm-6 col-md-3 form-group overflow-hidden">
					<div class="col-xs-4 aw-p0 aw-list-input-title">球队名称：</div>
					<div class="col-xs-8 aw-p0"><input type="text" id="name" name="name" v-model="form.name" :value="form.name" placeholder="请输入球队名称" class="form-control"></div>
				</div>
				<div class="col-sm-6 col-md-3 form-group overflow-hidden">
					<div class="col-xs-4 aw-p0 aw-list-input-title">队长：</div>
					<div class="col-xs-8 aw-p0"><input type="text" id="phone" name="phone" v-model="form.phone" :value="form.phone" placeholder="请输入队长昵称或手机号" class="form-control"></div>
				</div>
				<div class="col-sm-6 col-md-3 form-group overflow-hidden">
					<button class="btn btn-green" v-on:click="List_Search()"><i class="icon-search"></i> 搜索</button>
					<a href="/admin/team/list?page_id=5" class="btn btn-gray"><i class="icon-refresh"></i> 重置</a>
				</div>
			</div>
			<header class="panel-heading aw-mt20">球队列表</header>
			<table class="table table-striped dataTable table-hover">
				<thead>
					<tr>
						<th>ID</th>
						<th>球队名称</th>
						<th>成立时间</th>
						<th>平均年龄</th>
						<th>球队主色</th>
						<th>球队人数</th>
						<th>队长</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="(list, key) in lists" :data-key="key" :data-id="list.id">
						<td>@{{list.id}}</td>
						<td>@{{list.name}}</td>
						<td>@{{list.create_time}}</td>
						<td>@{{list.avg_age}}</td>
						<td>@{{list.colour}}</td>
						<td>@{{list.people_number}}</td>
						<td>@{{list.admin_name}}</td>
						<td>
							<a class="btn btn-blue btn-xs" :href="'/admin/team/info?page_id=5&id='+list.id">
								<i class="icon-file-text-alt"></i> 球队详情
							</a>
							<button class="btn btn-gules btn-xs" v-on:click="List_Status_Edit(list.id,2,'禁用',list.name)" v-if="list.status==1">
								<i class="icon-eye-close"></i> 禁用
							</button>
							<button class="btn btn-green btn-xs" v-on:click="List_Status_Edit(list.id,1,'启用',list.name)" v-if="list.status==2">
								<i class="icon-eye-open"></i> 启用
							</button>
						</td>
					</tr>
				</tbody>
			</table>
			<div class="aw-text-center aw-list-null" v-if="lists.length==0">暂无数据</div>
			<vue-page :page_item="page_item" :page_this="page_this" :page_all="page_all" :Call_back="Call_back"></vue-page>
		</section>
	</div>
</div>

@section('pagejs')
@parent

<script type="text/javascript" src="/admin/js/vue-page.js"></script>
<script type="text/javascript" src="/admin/js/page.js"></script>
<script type="text/javascript">
var MJS_URLArry=URLArry;
var Get_form={
	page_id:'',name:'',phone:''
}
$.extend(Get_form,MJS_URLArry);
var AD_list={
	api:'/adminapi/team/team-list',
	form_data:Get_form,
	tips:false,
}
var Ajax_Vue_Fun=function(vue_data){
	console.log('vue_data')
	console.log(vue_data)
	var Data_Vue=ajax_data_res(vue_data)
	Data_Vue.form=Get_form;
	vm=new Vue({
		el:'#Vue-Body',
		data:Data_Vue,
		components:{
			'vue-page':Vpage
		},methods:{
			Call_back:function(page){
				Vm_Call_back_Page(page)
			},List_Status_Edit:function(id,status,tips,name){
				var tips=tips+'球队 ['+name+'] ';
				var AD_status={
					api:'/adminapi/team/change',
					form_data:{id:id,status:status},
					tips:tips+'成功',
					msg:'是否'+tips+'?',
				}
				Vm_List_Status(AD_status)
			},List_Search:function(){
				if(!this.form.name && !this.form.phone){
					msgTips('球队名称或者队长总得填写一个吧',2)
					return;
				}
				Vm_List_SearchText('球队',{name:this.form.name,phone:this.form.phone})
			}
		}
	})
	URL_Make(vm.form)
}
getData(AD_list,Ajax_Vue_Fun)
</script>
@endsection

@endsection

